import os
import sys
from pathlib import Path
from PyQt5 import QtQml,QtQuick
from PyQt5.QtCore import *

from PySide6.QtGui import QGuiApplication # pip install pyside6 -i https://pypi.tuna.tsinghua.edu.cn/simple
from PySide6.QtQml import QQmlApplicationEngine

if __name__ == "__main__":
    app = QGuiApplication(sys.argv) # 创建Qt主程序
    engine = QQmlApplicationEngine() # 创建解析QML的引擎
    engine.load(os.fspath(Path(__file__).resolve().parent / "TestPageTaskD.qml")) # engine加载QML文件
    if not engine.rootObjects():
        sys.exit(-1)
    sys.exit(app.exec_())

# app = QGuiApplication(sys.argv)
# engine = QtQml.QQmlApplicationEngine(QUrl('PageTaskD.qml'))
# engine.quit.connect(app.quit)
# sys.exit(app.exec_())